import { getAll, giteeData } from './background/gitee'
import webReq from './background/webReq'

console.log(webReq)

// 监听来自content-script的消息
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
  console.log('收到消息', request, sender, sendResponse)
  if (request.method === 'getAll') {
    getAll()
  }
})


chrome.webRequest.onCompleted.addListener((detail) => {
  if (detail.url.indexOf('https://gitee.com') > -1) {
    console.log(detail)
    if (detail.url.indexOf('?info_id=') > -1) {
      giteeData.info_url =  detail.url
    }
  }
}, { urls: [ '<all_urls>' ] })

export default {}
